<div id="modals">

<!--modals-->
</div>
<div class="row">
    <div class="top-handle-btn">
        <!--search-form-->

        <!--顶部提示信息-->
        <div class="note note-success">
            <p> 商品类型最多支持 <span style="color: red">3 </span>级，超出部分前端将不予展现 </p>
        </div>


    </div>
</div>




<div class="row">

    <!--main-content-->
    <table id="data-table" class="table table-striped table-bordered table-hover" width="100%">
        <thead>
        <tr>
            <th></th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        </tbody>
        <tfoot>
        </tfoot>
    </table>
</div>

<!--table-data-loader-->
<script type="text/javascript">
    var resourceUrl = "#";
    $(function () {
        DataTable.init({
            url: resourceUrl, //ajax请求url
            tableName: "data-table", //数据表table id
            paramsFormName: "search-form", //查询参数form id
            modal: "modals", //模态框div
            columns: [ //列对应的字段数组，注意顺序
                {
                    data: "nickname"
                },
                {
                    data: "tel"
                },
                {
                    data: "branchId",
                    visible: false
                },
                {
                    data: "createdAt",
                    type: "datetime"
                },
            ],
            options: [ //操作区域(id)
                {
                    icon: "fa fa-edit",
                    name: "加盟店更换",
                    option: "modal-edit",
                    edit: true,
                    url: resourceUrl + "/{id}",
                },
                {
                    icon: "fa fa-edit",
                    name: "积分调整",
                    option: "modal-integral",
                    edit: true,
                    url: resourceUrl + "/{id}/integral",
                },
                {
                    icon: "fa fa-remove",
                    name: "删除",
                    del: state,
                },
            ],
            endFnOnce: "loadSelect",
        });
    });

    function loadSelect(data) {
        var branches = data.branches;
        var lites = data.lites;
        $.each(branches, function (k, v) {
            $("select[name=branchId]").append("<option value='" + v.id + "'>" + v.branchName + "</option>");
        });
        $.each(lites, function (k, v) {
            $("select[name=liteId]").append("<option value='" + v.id + "'>" + v.liteName + "</option>");
        });
    }
    $("select").select2();
</script>